package com.zmn.plat.common.dictionary;

/**
 * 类描述：
 *
 * @author yangshuangping
 * @since 2021/07/01 15:41
 */
public enum ChannelContractModelEnum {
    /**
     * values
     */
    PLATFORM_FOR_COLLECTING(ChannelContractModelEnum.CHANNEL_PLATFORM_FOR_COLLECTING, "平台代收合同"),
    MAINTENANCE_SERVICE(ChannelContractModelEnum.CHANNEL_MAINTENANCE_SERVICE, "维修服务合同");

    /**
     * 渠道接入身份：1.渠道
     */
    public final static int CHANNEL_PLATFORM_FOR_COLLECTING = 1;
    /**
     * 渠道接入身份：2.客户
     */
    public final static int CHANNEL_MAINTENANCE_SERVICE = 2;

    private Integer code;
    private String name;

    ChannelContractModelEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static String getName(Integer code) {
        ChannelContractModelEnum of = of(code);
        return of == null ? null : of.getName();
    }

    public static ChannelContractModelEnum of(Integer code) {
        switch (code) {
            case 1:
                return PLATFORM_FOR_COLLECTING;
            case 2:
                return MAINTENANCE_SERVICE;
            default:
                return null;
        }
    }
}
